﻿using System.Collections.Generic;
using SW.Lite.Infrastructure.Common;
using SW.Lite.Model;

namespace SW.Lite.IDAL
{
    public interface IColumn
    {
        /// <summary>
        ///     数据是否存在
        /// </summary>
        /// <param name="id">ID</param>
        bool Exists(int id);

        /// <summary>
        ///     获取单个项
        /// </summary>
        /// <param name="id">ID</param>
        ColumnModel Single(int id);

        /// <summary>
        ///     获取所有项目
        /// </summary>
        PageList<ColumnModel> All();

        /// <summary>
        ///     获取所有项目
        /// </summary>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页大小</param>
        PageList<ColumnModel> All(int pageIndex, int pageSize);

        /// <summary>
        ///     插入数据
        /// </summary>
        ExecuteResult Insert(ColumnModel item);

        /// <summary>
        ///     更新数据
        /// </summary>
        ExecuteResult Update(ColumnModel item);

        /// <summary>
        ///     删除数据
        /// </summary>
        /// <param name="id">ID</param>
        ExecuteResult Delete(int id);

        /// <summary>
        ///     获取一级栏目
        /// </summary>
        PageList<ColumnModel> GetTops();

        /// <summary>
        ///     保存排序号
        /// </summary>
        /// <param name="columnSorts">栏目排序号</param>
        ExecuteResult SaveSorts(Dictionary<int, int> columnSorts);

        /// <summary>
        ///     获取子栏目
        /// </summary>
        /// <param name="columnId">父栏目ID</param>
        PageList<ColumnModel> GetChildren(int columnId);
    }
}